﻿@inject IDataCacheService _dataCacheService

<MDCard Outline="Outline" ShowHoverStyle="Clickable" Class="@($"h-100 pa-3 {(Clickable?"pointer":"")}")" Style="display: flex; flex-direction: column; justify-content: space-between;" OnClick="OnClick">
    <div>
        <CnGalWebSite.Shared.MasaComponent.Shared.Cards.Users.InfoCard Model="Model.User" HideRank Class="mb-2" Outline/>

        @if (Model.Socres.IsScored)
        {
            <CnGalWebSite.Shared.MasaComponent.Shared.Components.MasaRating Disable Value="(int)Model.Socres.TotalSocre" Label="总评" />
            <div class="label-large pb-2">
                @($"音乐{Model.Socres.MusicSocre}分,美术{Model.Socres.PaintSocre}分,剧本{Model.Socres.ScriptSocre}分,演出{Model.Socres.ShowSocre}分,程序{Model.Socres.SystemSocre}分"+((IsDubbing&& Model.Socres.CVSocre>0) ? $",配音{Model.Socres.CVSocre}分" : ""))
            </div>
            <div itemprop="reviewRating" itemscope itemtype="https://schema.org/Rating">
                <meta itemprop="worstRating" content="1">
                <meta itemprop="bestRating" content="10" />
                <meta itemprop="ratingValue" content="@Model.Socres.TotalSocre" />
            </div>
        }

        @if (string.IsNullOrWhiteSpace(Model.PlayImpressions) == false)
        {
            <div class="text-truncate-6">
                评语：
                <span itemprop="reviewBody" style=" white-space: break-spaces;">
                    @Model.PlayImpressions
                </span>
            </div>
        }
    </div>
    @if (ShowAction)
    {
        <div style="display: flex; flex-direction: column; align-items: center;">
            <MButton Rounded OnClick="OnEdit" Color="primary">
                <MIcon Left>mdi-pencil </MIcon>
                编辑游玩记录
            </MButton>
            @if (IsPublic == false)
            {
                <span>
                    仅自己可见
                </span>
            }
            @if (string.IsNullOrWhiteSpace(GameName) == false)
            {
                <div class="mt-2 pb-2" itemprop="name">
                    @($"《{GameName}》")
                </div>
            }
            <div class="label-large mt-2">
                @Model.LastEditTime.ToString("yyyy-MM-dd HH:mm:ss")
            </div>
        </div>
    }
    else
    {
        @if (string.IsNullOrWhiteSpace(GameName) == false)
        {
            <div class="label-large mt-4">
                @($"《{GameName}》")
            </div>
        }
        <div class="label-large mt-4">
            @Model.LastEditTime.ToString("yyyy-MM-dd HH:mm:ss")
        </div>
    }



    <meta itemprop="datePublished" content="@Model.LastEditTime.ToString("yyyy-MM-dd HH:mm:ss")">

</MDCard>

@code {
    [Parameter]
    public PlayedGameUserScoreModel Model { get; set; }
    [Parameter]
    public EventCallback OnEdit { get; set; }
    [Parameter]
    public EventCallback OnClick { get; set; }
    [Parameter]
    public string GameName { get; set; }
    [Parameter]
    public bool Clickable { get; set; }

    [Parameter]
    public bool Outline { get; set; }
    [Parameter]
    public bool ShowAction { get; set; }
    [Parameter]
    public bool IsPublic { get; set; }
    [Parameter]
    public bool IsDubbing { get; set; }

}
